package com.architecture.util.time;

import java.text.DateFormatSymbols;
import java.util.Collection;
import java.util.LinkedList;
import java.util.Locale;

import com.architecture.util.object.ObjectUtility;

/**
 * <p>This class has utilities methods for be used with Time.</p>
 * @author JR
 * @version 1.0
 * @category Time Utilities
 */
public final class TimeUtility {
	
	/**
	 * <p>Build a collections of <code>Day</code> that represents a day.</p>
	 * @return <code>Collection<Day></code>
	 */
	public static Collection<Day> getDays(){
		final DateFormatSymbols dateFormatSymbols = DateFormatSymbols.getInstance(Locale.getDefault());
		final String[] daysDescription = dateFormatSymbols.getWeekdays();
		final String[] daysShortDescription = dateFormatSymbols.getShortWeekdays();
		
		final Collection<Day> dayList = new LinkedList<Day>();
		if(ObjectUtility.isAllRef(daysDescription,daysShortDescription)){
			final int length = daysDescription.length;
			for(int i = 0; i < length;i++){
				dayList.add(new Day(i, daysDescription[i], daysShortDescription[i]));
			}
		}
		
		return dayList;
	}
	
	public static void main(String[] args) {
		for(final Day day : getDays()){
			System.out.println(day.getId());
			System.out.println(day.getDescription());
			System.out.println(day.getShortDescription());
			System.out.println();
		}
	}
}
